package dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnectionFactory {
	
	public static Connection getConnection() throws SQLException
	{
		Connection conn = null;
		try
		{
			
			Class.forName("com.mysql.jdbc.Driver").newInstance();
			System.out.println("Conectando ao Banco");
			conn = DriverManager.getConnection("jdbc:mysql://localhost/banca_alecrim", "root" , "123");
			//conn = DriverManager.getConnection("jdbc:mysql://tux.lcc.ufrn.br/banca_alecrim", "alecrim" , "1234");
		}
		catch (ClassNotFoundException e)
		{
			throw new SQLException(e.getMessage());
		}
		catch( InstantiationException e) {
			e.printStackTrace();
		}
		catch( IllegalAccessException e) {
			e.printStackTrace();
		}
		return conn;
	}

}
